package com.fenxiangle.yueding.feature.order.view.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fenxiangle.yueding.R;
import com.fenxiangle.yueding.entity.bo.CommentBo;
import com.fenxiangle.yueding.entity.bo.TeamBo;
import com.suozhang.framework.framework.AM;

import java.util.List;

/**
 * @ProjectName: YueDing
 * @Package: com.fenxiangle.yueding.feature.order.view.adapter
 * @ClassName: ContactDetailAdapter
 * @Description: java类作用描述
 * @Author:
 * @CreateDate: 2019/3/8 18:11
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/3/8 18:11
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class ContactDetailAdapter extends BaseQuickAdapter<TeamBo, BaseViewHolder> {

    public ContactDetailAdapter() {
        super(R.layout.item_contact_detail);
    }

    //	-1=已失效,0=待抢单,1=已抢单,2=已选定,3=交易中,4=待确认,5=待评价,6=申诉中，7=已完成
    @Override
    protected void convert(BaseViewHolder helper, TeamBo item) {
        helper.setText(R.id.tv_level_name, item.getUserName() + "抢单")
                .setText(R.id.tv_level_id, "信用分:"+(int)  item.getCreditScore())
                .setVisible(R.id.tv_level_member, true)
                .setBackgroundRes(R.id.tv_level_member, (item.getGrabStatus() == 1 ? R.drawable.ic_order_btn_bg : R.color.transparent))
                .setTextColor(R.id.tv_level_member, item.getMembershipLevel() == 0 ? AM.res().getColor(R.color.primary_comparison) : AM.res().getColor(R.color.text_remind_3))
                .addOnClickListener(R.id.iv_level_head)
                .addOnClickListener(R.id.btn_call_phone)
                .addOnClickListener(R.id.btn_copy_wx)
                .addOnClickListener(R.id.btn_my_activist)
                .addOnClickListener(R.id.btn_my_publish_confrim)
                .addOnClickListener(R.id.tv_level_member);
        AM.image().bindToCircleObject(item.getUserHead(), helper.getView(R.id.iv_level_head));

        if (item.getGrabStatus() == 6) {//申诉中
            helper.getView(R.id.btn_my_activist).setVisibility(View.GONE);
            helper.getView(R.id.btn_my_in_activist).setVisibility(View.VISIBLE);
            helper.getView(R.id.btn_my_publish_confrim).setBackgroundResource(R.drawable.bg_order_refuse);
            helper.setText(R.id.btn_my_publish_confrim, "提交资料");
        } else if (item.getGrabStatus() == 7 || item.getGrabStatus() == 5) {//已完成 待评价都不显示按钮
            helper.getView(R.id.btn_my_activist).setVisibility(View.GONE);
            helper.getView(R.id.btn_my_in_activist).setVisibility(View.GONE);
            helper.getView(R.id.btn_my_publish_confrim).setVisibility(View.GONE);
        }
        if (!TextUtils.isEmpty(type)) {//查看列表
            helper.getView(R.id.btn_my_activist).setVisibility(View.GONE);
            helper.getView(R.id.btn_my_publish_confrim).setVisibility(View.GONE);
        }
    }

    private String type;

    public void setType(String type) {
        this.type = type;
    }
}
